"""
每日充电：第三周第1节课作业
用for循环和while来完成简单的计数
"""
"""计算字符串长度"""
s = "hello word!"
len = 0
for i in s:
    len += 1
    print(i)

print(len)

"""计算10以内的和"""
a = 0
sum = 0
while True:
    sum += a
    a += 1
    if a > 10:
        print(sum)
        break

"""用for循环和while循环两种方式来实现斐波那契函数, 限制在100以内"""
# n = int(input("请输入一个3~100以内的数：\n"))
# l =[1,1]
# for i in range(n-2):
#         j =i+1
#         v = l[i]+l[j]
#         l.append(v)
# print(l)

m = int(input("请输入一个3~100以内的数：\n"))
l2 = [1,1]
i = 0
while True:
    if m-2 ==0:
        print(l2)
        break
    j = i+1

    v = l2[i] + l2[j]

    l2.append(v)
    i += 1
    m = m-1

